<template>
  <div>
    <van-nav-bar
      class="page-nav-bar"
      title="全部评论"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="mcell" v-for="(obj, index) in msg" :key="index">
      <div class="header">
        <span class="text">
          <img src="@/assets/头像.png" alt="" />{{
            obj.user_info.nickname
          }}</span
        >
        <span class="time"> {{ obj.add_time }}</span>
      </div>
      <div class="body">{{ obj.content }}</div>
    </div>
  </div>
</template>

<script>
import { getmsg } from "@/api/subject";

export default {
  data() {
    return {
      msg: [],
      mesdata: {
        valueId: this.$route.query.id,
        typeId: 1,
        page: 1,
        size: 40,
        showType: 0,
      },
    };
  },
  created() {
    this.grtdetail();
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    async grtdetail() {
      try {
        const { data } = await getmsg(this.mesdata);
        console.log(data);
        this.msg = data.data.data.reverse();
      } catch (err) {
        console.log(err);
      }
    },
  },
};
</script>

<style lang="less" scoped>
.mcell {
  padding: 0 50px;
  margin-bottom: 40px;
  .header {
    display: flex;
    justify-content: space-between;
    img {
      width: 70px;
      height: 70px;
      border-radius: 50%;
      margin-right: 30px;
    }
    .text {
      font-size: 36px;
    }
    .time {
      font-size: 20px;
      color: #666;
      line-height: 50px;
    }
  }
  .body {
    border-bottom: 1px solid #999;
    padding-bottom: 30px;
    font-size: 30px;
    height: auto;
  }
}
</style>